var $$ = mdui.JQ;

window.onload = function() {
  var windowWidth = $$(window).width();
  var leftDrawer = new mdui.Drawer("#left-drawer");
  if(windowWidth > 1024) {
    leftDrawer.open();
  }

  $$("#btn_backup").on("click", function(e) {
    (function smoothscroll(){
      var currentScroll = document.documentElement.scrollTop || document.body.scrollTop;
      if (currentScroll > 0) {
        window.requestAnimationFrame(smoothscroll);
        window.scrollTo (0,currentScroll - (currentScroll / 5));
      }
    })();
  });

  window.onscroll = function() {
    var osTop = document.documentElement.scrollTop || document.body.scrollTop;
    if (osTop > 160) {
      $$("#btn_backup").removeClass("mdui-fab-hide");
    } else {
      $$("#btn_backup").addClass("mdui-fab-hide");
    }
  };

};